import Axios from 'axios';
import nProgress from 'nprogress';
import 'nprogress/nprogress.css';
const service = Axios.create({
  baseURL: '/app-dev',
  timeout: 10000,
});

service.interceptors.request.use(
  (config) => {
    nProgress.start();
    return config;
  },
  (err) => {
    return Promise.reject(err);
  }
);

service.interceptors.response.use(
  (response) => {
    nProgress.done();

    return response.data;
  },
  (err) => {
    nProgress.done();

    return Promise.reject(err);
  }
);

export default service;
